﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Skala.master" AutoEventWireup="true" CodeFile="TeslimatAdresi.aspx.cs" Inherits="TeslimatAdresi" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">


    <script type="text/javascript">

        
        function AdresSil(AdresId) {
            var hidAdres = '#' + '<%= hidAdresId.ClientID  %>';
            var btnSil = '#' + '<%= btnSil.ClientID  %>';
            $(hidAdres).val(AdresId);
            $(btnSil).trigger("click");
        }

        function AdresKullan(AdresId) {
            var hidAdres = '#' + '<%= hidAdresId.ClientID  %>';
            var btnKullan = '#' + '<%= btnKullan.ClientID  %>';
            $(hidAdres).val(AdresId);
            $(btnKullan).trigger("click");
        }

        $(document).ready(function () {

            var dil = getCookie('dil');
            var butonValue;
            if (dil == 'TR') butonValue = 'ADRESİ KAYDET VE DEVAM ET';
            else butonValue = 'SAVE THE ADDRESS AND CONTINUE';
            $("#btnAdresEkle").val(butonValue);

            if ($('#' + '<%= hidRadio.ClientID  %>').val() == "birey") {
                $("#rbBirey").attr('checked', 'checked');
                $('#' + '<%= hidRadio.ClientID  %>').val("birey");
                $("#bireysel").show();
                $("#firma").hide();
            }
            else {
                $("#rbFirma").attr('checked', 'checked');
                $('#' + '<%= hidRadio.ClientID  %>').val("firma");
                $("#firma").show();
                $("#bireysel").hide();
            }

            $("input[name='optionsRadios']").change(function () {
                if ($("input[name='optionsRadios']:checked").val() == 'birey') {
                    $('#' + '<%= hidRadio.ClientID  %>').val("birey");
                $("#bireysel").show();
                $("#firma").hide();
            }
            else {
                $('#' + '<%= hidRadio.ClientID  %>').val("firma");
                $("#firma").show();
                $("#bireysel").hide();
            }
        });

            $("#btnAdresEkle").click(function () {
                var success = true;

                if ($("input[name='optionsRadios']:checked").val() == 'birey') {
                    if (!kontrolEt('#' + '<%= txtAdSoyad.ClientID  %>', "")) success = false;
                    if (!kontrolEt('#' + '<%= txtSahisAdres.ClientID  %>', "")) success = false;
                    if (!kontrolEt('#' + '<%= txtEPosta.ClientID  %>', "")) success = false;
            }
            else {
                if (!kontrolEt('#' + '<%= txtFirma.ClientID  %>', "")) success = false;
                if (!kontrolEt('#' + '<%= txtVergiDairesi.ClientID  %>', "")) success = false;
                if (!kontrolEt('#' + '<%= txtVergiNo.ClientID  %>', "")) success = false;
                if (!kontrolEt('#' + '<%= txtAdres.ClientID  %>', "")) success = false;

            }

            if (!kontrolEt('#' + '<%= txtTelefon.ClientID  %>', "")) success = false;
            if (!kontrolEt('#' + '<%= ilce.ClientID  %>', '-1')) success = false;
            if (!kontrolEt('#' + '<%= sehir.ClientID  %>', '-1')) success = false;
            if (!kontrolEt('#' + '<%= ulke.ClientID  %>', '-1')) success = false;
            if (success)
                $('#' + '<%= btnKaydet.ClientID  %>').trigger("click");
        });
        });

    $(document).ready(function () {
        var adres = Sys.WebForms.PageRequestManager.getInstance();


        adres.add_endRequest(function () {

            var dil = getCookie('dil');
            var butonValue;
            if (dil == 'TR') butonValue = 'ADRESİ KAYDET VE DEVAM ET';
            else butonValue = 'SAVE THE ADDRESS AND CONTINUE';
            $("#btnAdresEkle").val(butonValue);

            if ($('#' + '<%= hidRadio.ClientID  %>').val() == "birey") {
                $("#rbBirey").attr('checked', 'checked');
                $('#' + '<%= hidRadio.ClientID  %>').val("birey");
                $("#bireysel").show();
                $("#firma").hide();
            }
            else {
                $("#rbFirma").attr('checked', 'checked');
                $('#' + '<%= hidRadio.ClientID  %>').val("firma");
                $("#firma").show();
                $("#bireysel").hide();
            }

            $("input[name='optionsRadios']").change(function () {

                if ($("input[name='optionsRadios']:checked").val() == 'birey') {
                    $('#' + '<%= hidRadio.ClientID  %>').val("birey");
                    $("#bireysel").show();
                    $("#firma").hide();
                }
                else {
                    $('#' + '<%= hidRadio.ClientID  %>').val("firma");
                    $("#firma").show();
                    $("#bireysel").hide();
                }

            });
            $("#btnAdresEkle").click(function () {
                var success = true;

                if ($("input[name='optionsRadios']:checked").val() == 'birey') {
                    if (!kontrolEt('#' + '<%= txtAdSoyad.ClientID  %>', "")) success = false;
                    if (!kontrolEt('#' + '<%= txtSahisAdres.ClientID  %>', "")) success = false;
                    if (!kontrolEt('#' + '<%= txtEPosta.ClientID  %>', "")) success = false;
                }
                else {
                    if (!kontrolEt('#' + '<%= txtFirma.ClientID  %>', "")) success = false;
                    if (!kontrolEt('#' + '<%= txtVergiDairesi.ClientID  %>', "")) success = false;
                    if (!kontrolEt('#' + '<%= txtVergiNo.ClientID  %>', "")) success = false;
                    if (!kontrolEt('#' + '<%= txtAdres.ClientID  %>', "")) success = false;

                }

                if (!kontrolEt('#' + '<%= txtTelefon.ClientID  %>', "")) success = false;
                if (!kontrolEt('#' + '<%= ilce.ClientID  %>', '-1')) success = false;
                if (!kontrolEt('#' + '<%= sehir.ClientID  %>', '-1')) success = false;
                if (!kontrolEt('#' + '<%= ulke.ClientID  %>', '-1')) success = false;
                if (success)
                    $('#' + '<%= btnKaydet.ClientID  %>').trigger("click");
            });
        });
    });
    </script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

    <!--ÇANTAM ÜRÜN LİSTE-->
  <div id="kredi-karti-bilgileri-kapsam">
    <div class="odeme-adimlari-adres"> 
      <!--ESKİ ADRESLER-->

        
    <asp:HiddenField   ID="hidAdresId" runat="server" Value="0" />
    <asp:Button Style="display:none;"  ID="btnKullan" runat="server" UseSubmitBehavior="false"  OnClick="btnKullan_Click" Text="Button" />
    <asp:Button Style="display:none;"  ID="btnSil" runat="server" UseSubmitBehavior="false"  OnClick="btnSil_Click" Text="Button" />  

      <div class="kayitli-adres-kapsam">
          <asp:ListView runat="server" ID="listAdresler" DataSourceID="dsAdresler">
              <ItemTemplate>
                  <div class="kayitli-adres">
                      <p class="text-warning"><%# Eval( "AdresBaslik") %></p>
                      <p><%# Eval( "AdresAd") %></p>
                      <p><%# Eval( "Adres") %></p>
                      <p><%# Eval( "SehirUlke") %></p>
                      <p><%# Eval( "Telefon") %></p>
                      <button class="btn btn-danger" value="SİL"  onclick="AdresSil('<%#Eval( "AdresId")%>');" ><%# Eval( "ButonText") %></button>
                      <button class="btn btn-primary" value="BU ADRESİ KULLAN" onclick="AdresKullan('<%#Eval( "AdresId")%>');" ><%# Eval( "AdresButon") %></button>
                  </div>
              </ItemTemplate>
          </asp:ListView>
          <asp:SqlDataSource runat="server" ID="dsAdresler" ConnectionString='<%$ ConnectionStrings:Skala %>' SelectCommand="GetAdresler" SelectCommandType="StoredProcedure">
              <SelectParameters>
                  <asp:SessionParameter SessionField="UyeId" DefaultValue="-1" Name="UyeId" Type="Int32"></asp:SessionParameter>
                  <asp:CookieParameter CookieName="dil" DefaultValue="TR" Name="dil" Type="String"></asp:CookieParameter>
              </SelectParameters>
          </asp:SqlDataSource>
      </div>
      <!--//ESKİ ADRESLER--> 
      <!--YENİ ADRESLER-->
      <div class="yeni-fatura-adresi">
        <div class="fatura-tipi">
          <h4><legend><label id="lblTeslimatAdresi" runat="server"/></legend></h4>
          <br />
          <label style="display:none">Fatura Tipi</label>
            <asp:HiddenField runat="server" ID="hidRadio" Value="birey" />
          <div class="radio" style="display:none">
            <label>
              <input type="radio" name="optionsRadios" checked="checked" value="birey" id="rbBirey" >
              Bireysel Fatura (Şahıslar için) </label>
          </div>            
          <div class="radio" style="display:none">
            <label>
              <input type="radio" name="optionsRadios" value="firma" id="rbFirma">
              Kurumsal Fatura (Şirketler için) </label>
          </div>
        </div>
        <!--FATURA TİPİ BİREYSEL-->
        <div class="fatura-tipi-kurumsal">
          <div class="fatura-tipi-kurumsal-sol" style="display:none" id="firma">
            <div class="" style="float:left; widows:450px;">
              <div class="form-horizontal" >
                <fieldset>
                  
                  <!-- Form Name --><!-- Text input-->
                  <div class="form-group">
                    <label class="col-sm-3 control-label" for="textinput"  >Firma</label>
                    <div class="col-sm-8">
                        <asp:TextBox ID="txtFirma" runat="server"  placeholder="Firma" class="form-control"  > </asp:TextBox>
                    </div>
                  </div>
                  <div class="form-group">
                    <label class="col-sm-3 control-label" for="textinput">Vergi Dairesi</label>
                    <div class="col-sm-8">
                        <asp:TextBox ID="txtVergiDairesi" runat="server"  placeholder="Vergi dairesi" class="form-control"  > </asp:TextBox>
                    </div>
                  </div>
                  <div class="form-group">
                    <label class="col-sm-3 control-label" for="textinput">Vergi No</label>
                    <div class="col-sm-8">
                        <asp:TextBox ID="txtVergiNo" runat="server"  placeholder="Vergi no" class="form-control"  > </asp:TextBox>
                    </div>
                  </div>
                  <!-- Text input-->
                  <div class="form-group">
                    <label class="col-sm-3 control-label" for="textinput">Adres</label>
                    <div class="col-sm-8">
                      <textarea class="form-control" placeholder="Adres" runat="server" id="txtAdres"></textarea>
                    </div>
                  </div>
                  
                  <!-- Text input-->
                  <div class="form-group" style="width:500px;">
                    <label class="col-sm-3 control-label" for="textinput">Posta Kodu</label>
                    <div class="col-sm-8">
                        <asp:TextBox ID="txtPostaKodu" runat="server"  placeholder="Posta kodu" class="form-control"  > </asp:TextBox>
                    </div>
                  </div>
                </fieldset>
              </div>
            </div>
            <!-- /.col-lg-12 --> 
          </div>

            <div class="fatura-tipi-kurumsal" id="bireysel">
        	<div class="" style="float:left; widows:450px;">
              <div class="form-horizontal">
                <fieldset>
                  
                  <!-- Form Name --><!-- Text input-->
                  <div class="form-group">
                    <label class="col-sm-3 control-label" for="textinput" id="lblAdSoyad" runat="server"></label>
                    <div class="col-sm-8">
                        <asp:TextBox ID="txtAdSoyad" runat="server"  placeholder="Ad Soyad" class="form-control"  > </asp:TextBox>
                    </div>
                  </div>
                  
                  <!-- Text input-->
                  <div class="form-group">
                    <label class="col-sm-3 control-label" for="textinput" id="lblAdres" runat="server"></label>
                    <div class="col-sm-8">
                      <textarea class="form-control" placeholder="Adres" id="txtSahisAdres" runat="server"></textarea>
                    </div>
                  </div>
                  
                  <!-- Text input-->
                  <div class="form-group" style="width:500px;">
                    <label class="col-sm-3 control-label" for="textinput" id="lblPostaKodu" runat="server"></label>
                    <div class="col-sm-8">
                        <asp:TextBox ID="txtSahisPostaKodu" runat="server"  placeholder="PostaKodu" class="form-control"  > </asp:TextBox>
                    </div>
                  </div>

                    <!-- Text input-->
                  <div class="form-group" style="width:500px;">
                    <label class="col-sm-3 control-label" for="textinput" id="lblEPosta" runat="server"></label>
                    <div class="col-sm-8">
                        <asp:TextBox ID="txtEPosta" runat="server"  placeholder="E-Posta" class="form-control"  > </asp:TextBox>
                    </div>
                  </div>

                    <div class="form-group">
                    <label class="col-sm-3 control-label" for="textinput" id="lblHediyeNotu" runat="server">Hediye Notu </label>
                    <div class="col-sm-8">
                      <textarea class="form-control" placeholder="Hediye notu" id="txtHediyeNotu" runat="server"></textarea>
                    </div>
                  </div>

                    <div class="form-group">
                    <label class="col-sm-3 control-label" for="textinput" id="Label1" runat="server"></label>
                    <div class="col-sm-8">
                        <asp:CheckBox ID="cbHediye" runat="server" Text="Hediye paketi olsun" />
                    </div>
                  </div>


                </fieldset>
              </div>
            </div>
        </div>

          <div class="fatura-tipi-kurumsal-sag">
            <div class="" style="float:left; width:550px;">
              <div class="form-horizontal" role="form">
                <fieldset>                  
                  <!-- Form Name --><!-- Text input-->
                  <div class="form-group">
                    <label class="col-sm-3 control-label" for="textinput" id="lblUlke" runat="server"></label>
                    <div class="col-sm-8">
                        <asp:DropDownList ID="ulke" class="form-control col-sm-2" runat="server" AutoPostBack="True" DataSourceID="dsUlke" DataTextField="UlkeAdi" DataValueField="UlkeId">
                        </asp:DropDownList>
                        <asp:SqlDataSource runat="server" ID="dsUlke" ConnectionString='<%$ ConnectionStrings:Skala %>' SelectCommand="GetUlkeler" SelectCommandType="StoredProcedure">
                            <SelectParameters>
                                <asp:CookieParameter CookieName="dil" DefaultValue="TR" Name="Dil" Type="String"></asp:CookieParameter>
                            </SelectParameters>
                        </asp:SqlDataSource>
                    </div>
                  </div>
                  
                  <!-- Text input-->
                  <div class="form-group">
                    <label class="col-sm-3 control-label" for="textinput" id="lblSehir" runat="server"></label>
                    <div class="col-sm-8">
                        <asp:DropDownList ID="sehir" class="form-control col-sm-2" runat="server" AutoPostBack="True" DataSourceID="dsSehir" DataTextField="SehirAdi" DataValueField="SehirId">
                        </asp:DropDownList>
                        <asp:SqlDataSource runat="server" ID="dsSehir" ConnectionString='<%$ ConnectionStrings:Skala %>' SelectCommand="GetSehirler" SelectCommandType="StoredProcedure">
                            <SelectParameters>
                                <asp:ControlParameter ControlID="ulke" PropertyName="SelectedValue" DefaultValue="-1" Name="UlkeId" Type="Int32"></asp:ControlParameter>
                                <asp:CookieParameter CookieName="dil" DefaultValue="TR" Name="Dil" Type="String"></asp:CookieParameter>
                            </SelectParameters>
                        </asp:SqlDataSource>
                    </div>
                  </div>
                  
                  <!-- Text input-->
                  <div class="form-group">
                    <label class="col-sm-3 control-label" for="textinput" id="lblIlce" runat="server"></label>
                    <div class="col-sm-8">
                      <asp:DropDownList ID="ilce" class="form-control col-sm-2" runat="server"  DataSourceID="dsIlce" DataTextField="IlceAdi" DataValueField="ilceId">
                        </asp:DropDownList>
                        <asp:SqlDataSource runat="server" ID="dsIlce" ConnectionString='<%$ ConnectionStrings:Skala %>' SelectCommand="GetIlceler" SelectCommandType="StoredProcedure">
                            <SelectParameters>
                                <asp:ControlParameter ControlID="sehir" PropertyName="SelectedValue" DefaultValue="-1" Name="SehirId" Type="Int32"></asp:ControlParameter>
                                <asp:CookieParameter CookieName="dil" DefaultValue="TR" Name="Dil" Type="String"></asp:CookieParameter>
                            </SelectParameters>
                        </asp:SqlDataSource>
                    </div>
                  </div>
                  
                  <!-- Text input-->
                  <div class="form-group">
                    <label class="col-sm-3 control-label" for="textinput" id="lblSemt" runat="server"></label>
                    <div class="col-sm-8">
                        <asp:TextBox ID="txtSemt" runat="server"  placeholder="Semt" class="form-control"  > </asp:TextBox>
                    </div>
                  </div>
                  
                  <!-- Text input-->
                  <div class="form-group">
                    <label class="col-sm-3 control-label" for="textinput" id="lblTelefon" runat="server"></label>
                    <div class="col-sm-8">
                        <asp:TextBox ID="txtTelefon" runat="server"  placeholder="Telefon" class="form-control"  > </asp:TextBox>
                    </div>
                  </div>
                  <div class="form-group">
                    <label class="col-sm-3 control-label" for="textinput" id="lblTelefon2" runat="server"></label>
                    <div class="col-sm-8">
                        <asp:TextBox ID="txtTelefon2" runat="server"  placeholder="Telefon 2" class="form-control"  > </asp:TextBox>
                    </div>
                  </div>
                  <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-9">
                      <div class="col-sm-offset-1 col-sm-14">
                        <label>
                            <asp:CheckBox ID="chkAyniAdres" runat="server" Text="Fatura adresimle teslimat adresim aynı olsun. " />
                          
                          </label>
                      </div>
                      <div class="pull-right">
                          <input type="button" class="btn btn-primary" value="ADRESİ KAYDET VE DEVAM ET" id="btnAdresEkle"  />
                          <asp:Button ID="btnKaydet" runat="server" Text="Adres Ekle" OnClick="btnKaydet_Click" UseSubmitBehavior="false"  style="display:none" />
                      </div>
                    </div>
                  </div>
                </fieldset>
              </div>
            </div>
            <!-- /.col-lg-12 --> 
          </div>
        </div>
        <!--//FATURA TİPİ KURUMSAL--> 
        <!--FATURA TİPİ BİREYSEL-->
        
        <!--//FATURA TİPİ BİREYSEL-->
      </div>
      <!--//YENİ ADRESLER--> 
    </div>
  </div>
  <!--//ÇANTAM ÜRÜN LİSTE-->

</asp:Content>


